TITLE input1_2.asc: UAV Cruise and Target Attack
// Input for Lab1 'QuickStart', HandsOn1_2
// Line guidance replaced by arc guidance
// Based on input_baseline.asc
OPTIONS y_scrn n_comscrn y_events n_tabout y_plot y_traj y_csv n_merge y_doc 
MODULES
	environment		def,init,exec
	aerodynamics	def,exec	
	propulsion		def,init,exec	
	forces			def,exec	
	newton			def,init,exec	
	targeting		def,exec
	seeker			def,exec
	guidance		def,exec
	control			def,exec	
	intercept		def,exec
END
TIMING
	scrn_step 50
	plot_step 0.2
	traj_step 0.5
	int_step 0.05
	com_step 40
END
VEHICLES 3
	CRUISE3 UAV
		//Initial conditions
			lonx  14.7    //Vehicle longitude - deg  module newton
			latx  35.4    //Vehicle latitude - deg  module newton
			alt  7000    //Vehicle altitude - m  module newton
			psivgx  90    //Vehicle heading angle - deg  module newton
			thtvgx  0    //Vehicle flight path angle - deg  module newton
			dvbe  200    //Vehicle speed - m/s  module newton
			alphax  0    //Angle of attack - deg  module control
			phimvx  0.0    //Bank angle - deg  module control
		//Aerodynamics
			AERO_DECK cruise3_aero_deck.asc
		//Mass properties and propulsion
			mprop  4    //'int' Mode switch - ND  module propulsion
			mach_com  0.7    //Commanded Mach number - ND  module propulsion
			mass_init  1000    //Initial vehicle mass - kg  module propulsion
			fuel_init  150    //Initial fuel - kg  module propulsion
			gfthm  893620    //Gain of Mach hold loop - N  module propulsion
			tfth  1    //Time constant of Mach hold loop - s  module propulsion
			PROP_DECK cruise3_prop_deck.asc
		//seeker
			mseeker  0    //'int' Mode switch - ND  module seeker
			acq_range  10000    //Seeker acquisition range - m  module seeker
		//guidance
			mguidance  70    //'int' Switch for guidance options - ND  module guidance
			pronav_gain  3    //Proportional navigation gain - ND  module guidance
		//autopilot
			mcontrol  36    //'int' Mode switch - ND  module control
		//loadfactor controller
			anposlimx  3    //Positive load factor limiter - g's  module control
			anneglimx  -1    //Negative load factor limiter - g's  module control
			gacp  10    //Root locus gain of accel loop - rad/s^2  module control
			ta  0.8    //Ratio of prop/integral gains. If>0, P-I engaged  module control
			alpposlimx  15    //Angle of attack positive limiter - deg  module control
			alpneglimx  -10    //Angle of attack negative limiter - deg  module control
		//lateral acceleration controller
			gcp  2    //Lateral roll gain - rad  module control
			allimx  1    //Lateral acceleration limiter - g's  module control
		//bank-angle controller
			philimx  70    //Bank angle command limiter - deg  module control
			tphi  0.5    //Time constant of bank angle response - sec  module control
		//altitude controller
			altcom  7000    //Altitude command  - m)  module control
			altdlim  50    //Altitude rate limiter - m/s  module control
			gh  0.3    //Altitude gain - g/m  module control
			gv  1.0    //Altitude rate gain - g/(m/s)  module control
		//heading controller
			psivgcx  90    //Commanded heading angle - deg  module control
			gain_psivg  12.0    //Heading angle hold control gain - ND  module control
		//flight path angle controller
			gain_thtvg  30    //Flight path angle hold control gain - g/deg  module control
		//Waypoint #1
			wp_lonx  14.9    //Longitude of way point - deg  module guidance
			wp_latx  35.4    //Latitude of way point - deg  module guidance
			IF   wp_flag = -1
			//Waypoint #2
				wp_lonx  15.25    //Longitude of way point - deg  module guidance
				wp_latx  35.54    //Latitude of way point - deg  module guidance
				altcom  5000    //Altitude command  - m)  module control
			ENDIF
			IF   wp_flag = -1
			//Waypoint #3
				wp_lonx  15.43    //Longitude of way point - deg  module guidance
				wp_latx  35.44    //Latitude of way point - deg  module guidance
				altcom  2000    //Altitude command  - m)  module control
			ENDIF
			IF   wp_flag = -1
			//after Waypoint #3, hold heading at 180 and descend to 1500 m
			//turn-on seeker and intercept nearest target 
				mguidance  0    //'int' Switch for guidance options - ND  module guidance
				mseeker  1    //'int' Mode switch - ND  module seeker
				mcontrol  16    //'int' Mode switch - ND  module control
				altcom  1500    //Altitude command  - m)  module control
			//heading controller
				psivgcx  180    //Commanded heading angle - deg  module control
				gain_psivg  12.0    //Heading angle hold control gain - ND  module control
			ENDIF
			IF mseeker = 3
			//seeker is locked up
				mguidance  66    //'int' Switch for guidance options - ND  module guidance
				mcontrol  44    //'int' Mode switch - ND  module control
			ENDIF
	END
	TARGET3 Tank_t1
			lonx  15.4    //Vehicle longitude - deg  module newton
			latx  35.3    //Vehicle latitude - deg  module newton
			alt  100    //Vehicle altitude - m  module newton
			psivgx  45    //Vehicle heading angle - deg  module newton
			dvbe  10    //Vehicle speed - m/s  module newton
	END
	SATELLITE3 Sat_s1
		//Initial conditions
			lonx  10    //Vehicle longitude - deg  module newton
			latx  30    //Vehicle latitude - deg  module newton
			alt  500000    //Vehicle altitude - m  module newton
			psivgx  45    //Vehicle heading angle - deg  module newton
			thtvgx  0    //Vehicle flight path angle - deg  module newton
			dvbe  7700    //Vehicle speed - m/s  module newton
	END
END
ENDTIME 450
STOP
